package cart;

import goods.Goods;

import java.util.Objects;

public class ShoppingCart {
    private String name;
    private double price;
    private long amount;
    private long id;

    public ShoppingCart(String name, String price, String amount, String id) {
        this.name = name;
        this.price = Double.parseDouble(price);
        this.amount = Long.parseLong(amount);
        this.id = Long.parseLong(id);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public long getAmount() {
        return amount;
    }

    public void setAmount(long amount) {
        this.amount = amount;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ShoppingCart that = (ShoppingCart) o;
        return Double.compare(that.price, price) == 0 &&
                id == that.id &&
                Objects.equals(name, that.name);
    }

}
